package edu.spec.wfl.week08.class1.book.unit3;

public class Student {
    private int sNO;
    private String sName;
    private String sSex;
    private int sAge;
    private double sJava;

    public Student(int sNO,String  sName,String  sSex,int sAge,double sJava){
        this.sNO=sNO;
        this.sName=sName;
        this.sSex=sSex;
        this.sAge=sAge;
        this.sJava=sJava;
    }
    public int getNo(){
        return this.sNO;
    }
    public String getName(){
        return this.sName;
    }
    public String getSex(){
        return this.sSex;
    }
    public int getAge() {
        return this.sAge;
    }
    public double getJava(){
        return this.sJava;
    }

    public static void main(String[] args){
        Student sd1=new Student(1,"王奉琳1","男",5,50);
        Student sd2=new Student(2,"王奉琳2","女",10,60);
        Student sd3=new Student(3,"王奉琳3","男",15,70);
        Student sd4=new Student(4,"王奉琳4","女",20,80);
        Student sd5=new Student(5,"王奉琳5","男",25,90);

        System.out.println("学号:"+sd1.getNo()+"\t"+"姓名:"+sd1.getName()+"\t"+"性别:"+sd1.getSex()+"\t"+"年龄:"+sd1.getAge()+"\t"+"java的成绩:"+sd1.getJava());
        System.out.println("学号:"+sd2.getNo()+"\t"+"姓名:"+sd2.getName()+"\t"+"性别:"+sd2.getSex()+"\t"+"年龄:"+sd2.getAge()+"\t"+"java的成绩:"+sd2.getJava());
        System.out.println("学号:"+sd3.getNo()+"\t"+"姓名:"+sd3.getName()+"\t"+"性别:"+sd3.getSex()+"\t"+"年龄:"+sd3.getAge()+"\t"+"java的成绩:"+sd3.getJava());
        System.out.println("学号:"+sd4.getNo()+"\t"+"姓名:"+sd4.getName()+"\t"+"性别:"+sd4.getSex()+"\t"+"年龄:"+sd4.getAge()+"\t"+"java的成绩:"+sd4.getJava());
        System.out.println("学号:"+sd5.getNo()+"\t"+"姓名:"+sd5.getName()+"\t"+"性别:"+sd5.getSex()+"\t"+"年龄:"+sd5.getAge()+"\t"+"java的成绩:"+sd5.getJava());

        double ave=(sd1.getJava()+sd2.getJava()+sd3.getJava()+sd4.getJava()+sd5.getJava())/5;
        System.out.println("java语言成绩的平均值是："+ave);

        double []javaGrade={sd1.getJava(),sd2.getJava(),sd3.getJava(),sd4.getJava(),sd5.getJava()};
        double max=0,min=0;
        int i=0;
        for(;i<4;i++){
            max=javaGrade[0];
            if(max<javaGrade[i+1]){
                double a=max;
                max=javaGrade[i+1];
                javaGrade[i+1]=a;
            }
        }
        System.out.println("Java成绩最大值为:"+max);
        for(i=0;i<4;i++){
            min=javaGrade[0];
            if(min>javaGrade[i+1]){
                double b=min;
                min=javaGrade[i+1];
                javaGrade[i+1]=b;
            }
        }
        System.out.println("Java成绩最小值为:"+min);
    }
}
